table of contents
LSBLK(8) | System Administration | LSBLK(8) |
NAME¶
lsblk - list block devices
SYNOPSIS¶
lsblk [options] [device...]
DESCRIPTION¶
lsblk lists information about all available or the specified block devices. The lsblk command reads the sysfs filesystem and udev db to gather information. If the udev db is not available or lsblk is compiled without udev support, then it tries to read LABELs, UUIDs and filesystem types from the block device. In this case root permissions are necessary.
The command prints all block devices (except RAM disks) in a tree-like format by default. Use lsblk --help to get a list of all available columns.
The default output, as well as the default output from options like --fs and --topology, is subject to change. So whenever possible, you should avoid using default outputs in your scripts. Always explicitly define expected columns by using --output columns-list and --list in environments where a stable output is required.
Note that lsblk might be executed in time when udev does not have all information about recently added or modified devices yet. In this case it is recommended to use udevadm settle before lsblk to synchronize with udev.
The relationship between block devices and filesystems is not always one-to-one. The filesystem may use more block devices, or the same filesystem may be accessible by more paths. This is the reason why lsblk provides MOUNTPOINT and MOUNTPOINTS (pl.) columns. The column MOUNTPOINT displays only one mount point (usually the last mounted instance of the filesystem), and the column MOUNTPOINTS displays by multi-line cell all mount points associated with the device.
OPTIONS¶
-a, --all
-b, --bytes
-D, --discard
-d, --nodeps
-E, --dedup column
The usual use case is to de-duplicate output on system multi-path devices, for example by -E WWN.
-e, --exclude list
-f, --fs
-h, --help
-I, --include list
-i, --ascii
-J, --json
-l, --list
-M, --merge
-m, --perms
-n, --noheadings
-o, --output list
The default list of columns may be extended if list is specified in the format +list (e.g., lsblk -o +UUID).
-O, --output-all
-P, --pairs
-p, --paths
-r, --raw
-S, --scsi
-s, --inverse
-T, --tree[=column]
-t, --topology
-o NAME,ALIGNMENT,MIN-IO,OPT-IO,PHY-SEC,LOG-SEC,ROTA,SCHED,RQ-SIZE,RA,WSAME.
-V, --version
-w, --width number
-x, --sort column
-z, --zoned
--sysroot directory
EXIT STATUS¶
0
1
32
64
ENVIRONMENT¶
LSBLK_DEBUG=all
LIBBLKID_DEBUG=all
LIBMOUNT_DEBUG=all
LIBSMARTCOLS_DEBUG=all
LIBSMARTCOLS_DEBUG_PADDING=on
NOTES¶
For partitions, some information (e.g., queue attributes) is inherited from the parent device.
The lsblk command needs to be able to look up each block device by major:minor numbers, which is done by using /sys/dev/block. This sysfs block directory appeared in kernel 2.6.27 (October 2008). In case of problems with a new enough kernel, check that CONFIG_SYSFS was enabled at the time of the kernel build.
AUTHORS¶
Milan Broz <mbroz@redhat.com>, Karel Zak <kzak@redhat.com>
SEE ALSO¶
REPORTING BUGS¶
For bug reports, use the issue tracker at <https://github.com/karelzak/util-linux/issues>.
AVAILABILITY¶
The lsblk command is part of the util-linux package which can be downloaded from Linux Kernel Archive <https://www.kernel.org/pub/linux/utils/util-linux/>.
2022-02-14 | util-linux 2.37.4 |